<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加操作员表单</title>
<%
	String path = request.getContextPath();
	// 获得本项目的地址(例如: http://localhost:8080/MyApp/)赋值给basePath变量 
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	// 将 "项目路径basePath" 放入pageContext中，待以后用EL表达式读出。 
	pageContext.setAttribute("basePath", basePath);
	//out.write(basePath);
%>

<!-- Bootstrap core CSS -->
<link href="<%=basePath%>bootstrap3/css/bootstrap.min.css"
	rel="stylesheet">
<link href="data:text/css;charset=utf-8,"
	data-href="<%=basePath%>bootstrap3/css/bootstrap-theme.min.css"
	rel="stylesheet" id="bs-theme-stylesheet">
<link href="<%=basePath%>bootstrap3/css/docs.min.css" rel="stylesheet">

<script src="<%=basePath%>bootstrap3/js/jquery.min.js"></script>

<script src="<%=basePath%>bootstrap3/js/bootstrap.min.js"></script>

<script src="<%=basePath%>bootstrap3/js/docs.min.js"></script>

<script src="<%=basePath%>bootstrap3/js/ie10-viewport-bug-workaround.js"></script>
<style type="text/css">
#head {
	height: 100px;
	width: 100%;
	background: #0099FF;
	margin-left: auto;
	margin-right: auto;
}
</style>
<script type="text/javascript">
	$(function() {
		var addo = $("#addopeartor")[0].value;
		if (addo != null && addo != "") {
			alert(addo);
		}
	});

	function checkCode() {
		//获取用户名输入控件对象的内容
		var txtName = document.getElementById("opcode").value;
		//信息提示框
		var sptxtName = document.getElementById("spancode");
		if (txtName == null || txtName == "") {
			//验证失败
			isChecked = false;
			//提示信息					
			sptxtName.innerHTML = "请输入操作员的代码！";
			sptxtName.style.color = "#B92C28";
			//msg += "请输入姓名！\n"
			//					document.getElementById("txtName").focus();
			//修改标志变量
			return false;
		} else {
			sptxtName.innerHTML = "";
			//修改标志变量
			return true;
		}
	}
	function checkName() {
		//获取用户名输入控件对象的内容
		var txtName = document.getElementById("opname").value;
		//信息提示框
		var sptxtName = document.getElementById("spanopname");
		if (txtName == null || txtName == "") {
			//验证失败
			isChecked = false;
			//提示信息					
			sptxtName.innerHTML = "请输入操作员的姓名！";
			sptxtName.style.color = "#B92C28";
			//msg += "请输入姓名！\n"
			//					document.getElementById("txtName").focus();
			//修改标志变量
			return false;
		} else {
			sptxtName.innerHTML = "";
			//修改标志变量
			return true;
		}
	}
	function checkPassword() {
		//密码非空验证
		var txtPsw = document.getElementById("oppsw").value;

		//信息提示框
		var sptxtPsw = document.getElementById("spanoppsw");
		if (txtPsw == null || txtPsw == "") {

			//错误提示信息
			//提示信息					
			sptxtPsw.innerHTML = "请输入密码！";
			sptxtPsw.style.color = "#B92C28";
			return false;
		} else {
			//验证通过  清空提示内容
			sptxtPsw.innerHTML = "";
			return true;
		}
	}

	function checkPasswordTrue() {
		//密码非空验证
		var txtPswNow = document.getElementById("oppswtrue").value;

		var txtPswBefor = document.getElementById("oppsw").value;

		//信息提示框
		var sptxtPsw = document.getElementById("spanoppswtrue");
		if (txtPswNow != txtPswBefor || txtPswNow == null || txtPswNow == "") {

			//错误提示信息
			//提示信息					
			sptxtPsw.innerHTML = "两次密码不一样！";
			sptxtPsw.style.color = "#B92C28";
			return false;
		} else {
			//验证通过  清空提示内容
			sptxtPsw.innerHTML = "";
			return true;
		}
	}

	function checkAll() {
		//用户名验证
		var ischcode = checkCode();
		//密码验证
		var ischPswBefor = checkPassword();

		var ischePswNow = checkPasswordTrue();

		var ischName = checkName();

		var ischeUserAdress = checkUserAdress();

		if (ischName && ischPswBefor && ischePswNow && ischcode) {
			//验证通过
			return true;
		} else {
			return false;
		}
	}
</script>

</head>

<body>
	<input type="hidden" id="addopeartor"
		value="${sessionScope.addopeartor }">

	<div id="add">
		<div></div>
		<div id="head">
			<div
				style="height: 100%; width: 50%; margin-left: auto; margin-right: auto;">
				<div class="page-header">
					<h1>
						<span class="glyphicon glyphicon-pencil"></span>&nbsp;&nbsp;&nbsp;操&nbsp;作&nbsp;员&nbsp;信&nbsp;息&nbsp;录&nbsp;入
					</h1>
				</div>
			</div>
		</div>
		<div style="height: 30px; width: 100%;"></div>
		<form class="form-horizontal" role="form"
			action="<%=basePath%>manager/insertOp.action" method="post">
			<div style="width: 50%; margin-left: auto; margin-right: auto;">
				<div class="row" style="height: 50px;">
					<div class="col-md-4" align="center">
						<font face="仿宋" size="4">&nbsp;&nbsp;代&nbsp;码</font>
					</div>
					<div class="col-md-5">
						<input type="text" class="form-control" id="opcode" name="opcode"
							placeholder="请输入操作员代码" onblur="checkCode();">
					</div>
					<div class="col-md-3">
						<span id="spancode"></span>
					</div>
				</div>
				<hr />
				<div class="row" style="height: 50px;">
					<div class="col-md-4" align="center">
						<font face="仿宋" size="4">&nbsp;&nbsp;姓&nbsp;名</font>
					</div>
					<div class="col-md-5">
						<input type="text" class="form-control" id="opname" name="opname"
							placeholder="请输入操作员姓名" onblur="checkName();">
					</div>
					<div class="col-md-3">
						<span id="spanopname"></span>
					</div>
				</div>
				<hr />
				<div class="row" style="height: 50px;">
					<div class="col-md-4" align="center">
						<font face="仿宋" size="4">&nbsp;&nbsp;密&nbsp;码</font>
					</div>
					<div class="col-md-5">
						<input type="password" class="form-control" id="oppsw"
							name="oppsw" placeholder="请&nbsp;输&nbsp;入&nbsp;密&nbsp;码"
							onblur="checkPassword()";>
					</div>
					<div class="col-md-3">
						<span id="spanoppsw"></span>
					</div>
				</div>
				<hr />
				<div class="row" style="height: 50px;">
					<div class="col-md-4" align="center">
						<font face="仿宋" size="4">&nbsp;&nbsp;密&nbsp;码</font>
					</div>
					<div class="col-md-5">
						<input type="password" class="form-control" id="oppswtrue"
							name="oppswtrue" placeholder="请&nbsp;确&nbsp;定&nbsp;密&nbsp;码"
							onblur="checkPasswordTrue()";>
					</div>
					<div class="col-md-3">
						<span id="spanoppswtrue"></span>
					</div>
				</div>
				<hr />
				<div class="row" style="height: 50px;">
					<div class="col-sm-offset-3 col-md-2">
						<button type="submit" class="btn btn-default"
							onclick="checkAll();">&nbsp;添&nbsp;&nbsp;&nbsp;加&nbsp;</button>
					</div>
					<div class="col-sm-offset-2 col-md-4">
						<button type="reset" class="btn btn-default">&nbsp;重&nbsp;&nbsp;&nbsp;置&nbsp;</button>
					</div>
				</div>
			</div>
		</form>
	</div>

</body>

</html>